aboutsummaryrefslogtreecommitdiffstats
path: root/apps/mobile/app/dashboard/lists/[slug].tsx
blob: 54744874c70e86438a665b3e11793b35c04ac7f9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { useLocalSearchParams, Stack } from "expo-router";
import { View } from "react-native";

import BookmarkList from "@/components/bookmarks/BookmarkList";
import FullPageSpinner from "@/components/ui/FullPageSpinner";
import { api } from "@/lib/trpc";

export default function ListView() {
  const { slug } = useLocalSearchParams();
  if (typeof slug !== "string") {
    throw new Error("Unexpected param type");
  }
  const { data: list } = api.lists.get.useQuery({ listId: slug });

  if (!list) {
    return <FullPageSpinner />;
  }

  return (
    <>
      <Stack.Screen
        options={{
          headerTitle: `${list.icon} ${list.name}`,
        }}
      />
      <View>
        <BookmarkList archived={false} ids={list.bookmarks} />
      </View>
    </>
  );
}